package com.atlyn.dao;

import com.atlyn.bean.Root;
import com.atlyn.bean.Teacher;
import com.atlyn.utils.Tool;
import org.junit.Test;

public class LoginDao {
    Tool tool = new Tool();
    //根据老师的账号查询账号和密码
    public Teacher tLogin(int tid,String pwd){
        String sql = "select* from teacher where tid=? and tpwd=?";
        Teacher teacher = tool.getInstance(Teacher.class,sql,tid,pwd);
        if (teacher == null){
            return null;
        }else {
            return teacher;
        }
    }
    @Test
    public void play1(){
        Teacher t1 = tLogin(1,"wjg123456");
        System.out.println(t1.getTname());
    }
    //根据管理员账号查询管理员密码
    public Root rLogin(String rid,String pwd){
        String sql = "select* from root where rid=? and rpwd=?";
        Root root = tool.getInstance(Root.class,sql,rid,pwd);
        if (root == null){
            return null;
        }else {
            return root;
        }
    }
    @Test
    public void play2(){
        Root r1 = rLogin("zhku13579","r123456");
        System.out.println(r1);
    }

}
